package chinaums.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import chinaums.dao.RuleMapper;
import chinaums.entity.CodeMsg;
import chinaums.entity.Rule;
import chinaums.service.IRuleService;

/**
 * @author liyongjie
 * @date 2017年6月16日 上午9:19:30
 * @version 版本号码
 * @description 主要是实现IRuleService的方法
 */
@Service
public class RuleServiceImpl implements IRuleService {
	@Autowired
	private RuleMapper mapper;

	@Override
	public long rules_count(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return mapper.rule_count(map);
	}

	@Override
	public List<Map<String, Object>> selectall(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return mapper.selectall(map);
	}

	@Override
	public CodeMsg update_ruledate(Map<String, Object> map) {
		CodeMsg msg = new CodeMsg();
		long check = mapper.update_ruledate(map);
		if (check > 0) {
			msg.setCode("success");
			msg.setMsg("修改成功");
		} else {
			msg.setCode("fail");
			msg.setMsg("修改失败");
		}
		return msg;
	}

	@Override
	public CodeMsg delete_ruledate(Map<String, Object> map) {
		CodeMsg msg = new CodeMsg();
		long check = mapper.delete_ruledate(map);
		if (check > 0) {
			msg.setCode("success");
			msg.setMsg("删除成功");
		} else {
			msg.setCode("fail");
			msg.setMsg("删除失败");
		}
		return msg;
	}

	@Override
	public Map<String, Object> select_numbers(String number) {
		return mapper.select_numbers(number);
	}

	@Override
	public CodeMsg insert_ruleq(Map<String, Object> param) {
		// TODO Auto-generated method stub
		CodeMsg msg = new CodeMsg();
		long check = mapper.insert_ruleq(param);
		if (check > 0) {
			msg.setCode("success");
			msg.setMsg("新增成功");
		} else {
			msg.setCode("fail");
			msg.setMsg("新增失败");
		}
		return msg;
	}

	@Override
	public Rule select_exist(String number) {
		// TODO Auto-generated method stub
		return mapper.select_exist(number);
	}

	@Override
	public Rule select_gid(String gid) {
		// TODO Auto-generated method stub
		return mapper.select_gid(gid);
	}

	@Override
	public Rule select_order(Map<String, Integer> map) {
		// TODO Auto-generated method stub
		return mapper.select_order(map);
	}

	/*
	 * @Override public int updateRule(Map<String, Object> map) { // TODO
	 * Auto-generated method stub return mapper.updateRule(map); }
	 */
	/*
	 * 查询rule表中所有的数据(non-Javadoc)
	 * 
	 * @see chinaums.service.IRuleService#selectall()
	 */

	/*
	 * 根据r_rule_id查找相对应的规则编号(non-Javadoc)
	 * 
	 * @see chinaums.service.IRuleService#select_number(int)
	 */

	/*
	 * @Override public Rule select_number(int r_rule_id) { return
	 * mapper.select_number(r_rule_id);
	 * 
	 * }
	 */

	/*
	 * 根据相应的条件修改规则编号(non-Javadoc)
	 * 
	 * @see chinaums.service.IRuleService#updateRule(chinaums.entity.Rule)
	 */

	/*
	 * @Override public int updateRule(Rule rule) { // TODO Auto-generated
	 * method stub return mapper.updateRule(rule); }
	 */

	/*
	 * 根据r_id查找相应的规则编号(non-Javadoc)
	 * 
	 * @see chinaums.service.IRuleService#select_numbers(int)
	 */

	/*
	 * 查询所有信息(non-Javadoc)
	 * 
	 * @see chinaums.service.IRuleService#insert_all(java.util.Map)
	 */
	/*
	 * @Override public String insert_all(Rule rule) { return "true";
	 * 
	 * }
	 */

	/*
	 * @Override public Rule selectbynumber(String r_number) { // TODO
	 * Auto-generated method stub return mapper.selectbynumber(r_number); }
	 */

}
